package cn.usersmsg.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.usersmsg.biz.IUserBiz;
import cn.usersmsg.biz.UserBizIpml;
import cn.usersmsg.model.User;

public class SelectUserName extends HttpServlet {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String username = req.getParameter("username");
		PrintWriter out = resp.getWriter();
		IUserBiz iub = new UserBizIpml();
		List<User> list = iub.allUser(username);
		String users = "";
		for (int i = 0; i < list.size(); i++) {
			users += list.get(i).getUser_name()+"-";
		}
		if (users.length()>0) {
			users = users.substring(0, users.length()-1);
		}else{
			users = users.substring(0, 0);
		}
		out.print(users);
	}

}
